﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using System.Windows.Media.Imaging;
using VAdvantage.Apps;
using VAdvantage.Utility;

namespace VAdvantage.Framework
{
    public partial class AboutUs : ChildWindow
    {
        public AboutUs()
        {
            InitializeComponent();
            this.Title = Msg.GetMsg("AboutUs");
            this.Height = 500;
            this.Width = 620;
            //this.Left = 400;
            //this.Top = 90;
            this.MaxHeight = 500;
            this.MaxWidth = 620;
            busyIn.IsBusy = true;
            Load();
        }

        public void Load()
        {
            DataServiceBasic.DataServicesBasicClient service = AEnv.GetDataServiceBasicClient();
            service.AboutUSAsync();
            service.AboutUSCompleted += (se, ev) =>
                {
                    if (ev.Result != null)
                    {
                        DataServiceBasic.AboutUs about = ev.Result;
                        if (about.Logo != null)
                        {
                            MemoryStream mem = new MemoryStream(about.Logo);
                            BitmapImage img = new BitmapImage();
                            img.SetSource(mem);
                            imgLogo.Source = img;
                        }
                        if (about.Description != null)
                        {
                            txbDesc1.Text = about.Description;
                        }
                        if (about.Description1 != null)
                        {

                            txbDesc2.Text = about.Description1;
                        }
                        else
                        {
                            scrl1.MaxHeight = 365;
                            brdr.Visibility = Visibility.Collapsed;
                        }
                        if (about.Description != null && about.Description1 != null)
                        {
                            brdr.Visibility = Visibility.Visible;
                        }
                    }
                    service.CloseAsync();
                    busyIn.IsBusy = false;
                };
        }


    }
}

